<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后台管理系统</title>
    <meta name="referrer" content="no-referrer">
    <link rel="stylesheet" href="https://at.alicdn.com/t/c/font_4755950_cmhps6g8f.css">
    <link rel="stylesheet" href="../style/common.css">
</head>

<body>
    <header class="bg-base flex aic pl-20">
        <h3 class="fff">果莱人才网后台管理系统</h3>
    </header>

    <main class="bg-fff" style="margin-left: 0;">
        <div class="pl-30 mb-20 flex jc-sb pr-30">
            <span>修改用户信息</span>
            <!-- <span class="base cursor">添加</span> -->
        </div>
        <div class="ml-30 form">
            <p class="item mt-10">
                <span>用户名 </span>
                <input id="name" type="text" class="ml-10" placeholder="请输入" >
            </p>
            <p class="item mt-10">
                <span>密码</span>
                <input id="password" type="text" class="ml-10" placeholder="请输入" >
            </p>
           

            <p class="item mt-30 ml-30 pl-25">
                <button id="submit" class="btn submit ml-30">修改</button>
            </p>
        </div>

    </main>


    <script src="../js/jquery.js"></script>
    <script src="../js/axios.js"></script>
    <script src="../js/common.js"></script>
    <script>
      var editObj ={
        editData() {
        $('#submit').click(function(){
            var webUrl = location.href;
        var index = webUrl.indexOf("=");
        var id = webUrl.slice(index + 1);
        // 删除数据
        var url = 'http://localhost:3000/UserAdmind/'+id;
       if($('input').val()==''){
        alert('请填写完整的用户信息');
       }else{
        var data = {
                    name: $('#name').val(),
                    password: $('#password').val(),
                   
            // 更新时间
            uTime: Date.now()
        }
        axios.patch(url,data).then(function (res) {
            console.log(res);
        })
        location.href = './list.html';
        alert('修改成功');
       }
        })
        
    }
       
      }
      editObj.editData();
    </script>
    </body>
   </html>